//
//  UIViewController+SideMenu.m
//
//
//  Created by zhangrongwu on 2017/5/27.
//
//

#import "UIViewController+SideMenu.h"
#import "ICSideMenu.h"

@implementation UIViewController (SideMenu)

-(ICSideMenu *)sideMenu {
    UIViewController *slde = self.parentViewController;
    while (slde) {
        if ([slde isKindOfClass:[ICSideMenu class]]) {
            return (ICSideMenu *)slde;
        } else if (slde.parentViewController && slde.parentViewController != slde) {
            slde = slde.parentViewController;
        } else {
            slde = nil;
        }
    }
    return nil;
}

@end
